diff --git a/src/routes/[username]/transactions.svelte b/src/routes/[username]/transactions.svelte
index 1935b156..bbcc0c23 100644
--- a/src/routes/[username]/transactions.svelte
+++ b/src/routes/[username]/transactions.svelte
@@ -1,5 +1,51 @@
-
+{#if $user}
+
+
+
+
+ Transaction History
+
+
+
+
+
AMOUNT
+ TIME
+
+
+
+ {#if transactions.length}
+ {#each transactions as tx}
+
+
+ {new Intl.NumberFormat('en-US', {
+ style: 'currency',
+ currency: 'USD'
+ }).format(tx.amount * (tx.rate / 100000000))}
+
+
+ ({new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(tx.amount)}
+ SATS)
+
+
+
+
+ {new Date(tx.createdAt).toLocaleDateString(undefined, { dateStyle: 'medium' })}
+
+
+ {/each}
+ {:else}
+
No transactions yet.
+ {/if}
+
+
+
+{/if}
--
cgit v1.2.3
From 93f9d0abf58c5b5154e35b63524405554042bef1 Mon Sep 17 00:00:00 2001
From: secondl1ght <85003930+secondl1ght@users.noreply.github.com>
Date: Sat, 6 Aug 2022 00:04:55 -0600
Subject: finish withdraw UI, add more validation on support, bug fixes on tx
hist
---
src/lib/utils.js | 6 +-
src/routes/[username]/dashboard.svelte | 98 +++++++++++++++++++------------
src/routes/[username]/settings.svelte | 6 +-
src/routes/[username]/support.svelte | 19 +++++-
src/routes/[username]/transactions.svelte | 12 ++--
src/routes/withdraw.js | 3 +-
6 files changed, 88 insertions(+), 56 deletions(-)
(limited to 'src/routes/[username]/support.svelte')
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 24f94d40..b42fe970 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -19,11 +19,11 @@ export const get = (url, headers = { accept: 'application/json' }) =>
});
export const post = (url, body, headers) => {
- headers = { ...headers, accept: 'application/json', 'content-type': 'application/json' };
+ headers = { ...headers, accept: 'application/json', 'content-type': 'application/json' };
return fetch(base + url, {
method: 'POST',
body: JSON.stringify(body),
- headers
+ headers
})
.then((r) => r.text())
.then((body) => {
@@ -38,7 +38,7 @@ export const post = (url, body, headers) => {
return body;
});
-}
+};
export const copy = (text) => {
navigator.clipboard.writeText(text);
diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte
index 7fab2125..d056399f 100644
--- a/src/routes/[username]/dashboard.svelte
+++ b/src/routes/[username]/dashboard.svelte
@@ -1,7 +1,7 @@
{#if $user}
@@ -13,7 +15,13 @@
{/if}
diff --git a/src/routes/[username]/transactions.svelte b/src/routes/[username]/transactions.svelte
index 24e3e146..c91fd900 100644
--- a/src/routes/[username]/transactions.svelte
+++ b/src/routes/[username]/transactions.svelte
@@ -18,8 +18,8 @@
AMOUNT
- TYPE
- TIME
+ TYPE
+ TIME
@@ -28,19 +28,21 @@
{tx.amount > 0 && '+'}{new Intl.NumberFormat('en-US', {
+ >{tx.amount > 0 ? '+' : ''}{new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(tx.amount * (tx.rate / 100000000))}
{new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(tx.amount)}
+ >{tx.amount > 0 ? '+' : ''}{new Intl.NumberFormat('en-US', {
+ maximumFractionDigits: 0
+ }).format(tx.amount)}
SATS
-
+
{tx.amount < 0 ? 'Sent' : 'Received'}
diff --git a/src/routes/withdraw.js b/src/routes/withdraw.js
index aaed2250..818d39da 100644
--- a/src/routes/withdraw.js
+++ b/src/routes/withdraw.js
@@ -1,8 +1,7 @@
import { post } from '$lib/utils';
export async function POST({ locals, request }) {
let { token } = locals;
- let body = await request.json();
- console.log(body)
+ let body = await request.json();
body = await post('/lightning/send', body, {
authorization: `Bearer ${token}`
});
--
cgit v1.2.3